﻿Imports System.Data
Imports System.Collections.Generic

Partial Class noticias_listarNoticiasPesquisaAvancada
    Inherits System.Web.UI.Page

    Protected Sub btnPesquisar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPesquisar.Click
        If txtBuscaExpressao.Text = "" And txtBuscaQualquer.Text = "" And txtBuscaSem.Text = "" And txtBuscaTodas.Text = "" Then
            Accordion1.Visible = False
            lblErro.Visible = True
            lblErro.Text = "Por favor, preencha algum campo para busca."
        Else
            Dim lstBENoticia As List(Of extranet.BE.Noticia)
            lstBENoticia = extranet.BC.BCNoticia.PesquisarAvancada(txtBuscaExpressao.Text, txtBuscaQualquer.Text, txtBuscaSem.Text, txtBuscaTodas.Text)
            If lstBENoticia.Count = 0 Then
                lblErro.Visible = True
                lblErro.Text = "Nenhum resultado foi encontrado para esta busca."
                Accordion1.Visible = False
            Else
                lblErro.Visible = False
                Accordion1.Visible = True
                Accordion1.DataSource = lstBENoticia
                Accordion1.DataBind()
            End If
        End If
    End Sub
End Class
